﻿using System;
using System.Collections.Generic;
using System.Text;
using FileSystem.Models;
using GalaSoft.MvvmLight;

namespace FileSystem.ViewModels {
    /// <summary>
    /// 单个用户ViewModel
    /// </summary>
    public class UserViewModel : ViewModelBase {
        // ******** 构造函数
        public UserViewModel() { }

        // ******** 绑定属性

        /// <summary>
        /// 用户
        /// </summary>
        public User User {
            get => _user;
            set {
                Set(nameof(User), ref _user, value);
                if ((value as User).Authority ==
                    (int) UserConst.UserType.Administrator)
                    UserLocation = "管理员";
                else
                    UserLocation = "普通用户";
            }
        }

        /// <summary>
        /// 用户
        /// </summary>
        private User _user;

        /// <summary>
        /// 用户定位(管理员或普通用户)
        /// </summary>
        public string UserLocation {
            get => _userLocation;
            set => Set(nameof(UserLocation), ref _userLocation, value);
        }

        /// <summary>
        /// 用户定位(管理员或普通用户)
        /// </summary>
        private string _userLocation;

        // ******** 绑定命令

        // ******** 公开变量

        // ******** 私有变量
    }
}